#include "server/Server.hpp"
#include "scene/Scene.hpp"
#include "component/RenderComponent.hpp"
#include "Camera.hpp"

#include "Photonmapping.hpp"


namespace PhotonMapping
{
    using namespace std;
    using namespace NRenderer;

    class Adapter : public RenderComponent
    {
        void render(SharedScene spScene) {
            getServer().logger.log("Photon mapping...");
            PhotonMappingRenderer renderer{ spScene };
            auto renderResult = renderer.render();
            auto [pixels, width, height] = renderResult;
            getServer().screen.set(pixels, width, height);
            renderer.release(renderResult);
        }
    };
}

// REGISTER_RENDERER(Name, Description, Class)
REGISTER_RENDERER(PhotonMapping, "PhotonMapping", PhotonMapping::Adapter);